package com.cx.mall.user.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.cx.mall.common.util.GetIpAddress;
import com.cx.mall.user.entity.UserLoginLog;
import com.cx.mall.user.mapper.IUserLoginLogMapper;
import com.cx.mall.user.service.IUserLoginLogService;
import org.springframework.stereotype.Service;

@Service
public class UserLoginLogServiceImpl extends ServiceImpl<IUserLoginLogMapper, UserLoginLog> implements IUserLoginLogService {
    @Override
    public void writeLoginLog(Long userId) {
        UserLoginLog userLoginLog = new UserLoginLog();
        userLoginLog.setUserId(userId);
        String ip = GetIpAddress.getLocalIP();
        userLoginLog.setIp(ip);
        this.save(userLoginLog);
    }
}
